<template>
    <div class="footer">
        <div class="block">
            <el-pagination
                @current-change="handleCurrentChange"
                background
                layout="total, prev, pager, next, jumper"
                :current-page.sync="data.current_page"
                :page-size="data.size"
                :total="data.total"
                ref="pg">
            </el-pagination>
        </div>
    </div>
</template>
<script>
export default {
  props:['data'], //内含{total-总条数,size-每页条数,current_page-当前页}
  data() {
    return {
      currentDate: new Date(),
      toParentData:{ //传向主页的数据
        currentPage:1, //当前页
        pageSize:this.pageSize //每页记录数
      }
    };
  },
  mounted() {
    // this.$message(this.$props.data.total);
    // this.total=this.$props.data.total;
  },
  created(){
    //this.$emit("pageInfoChange",this.toParentData);       
  },
  watch:{
  },
  methods: {
    // handleSizeChange(val) {
    //     console.log(`每页 ${val} 条`);
    // },
    handleCurrentChange(val) {
      this.toParentData.currentPage=val;
      this.$emit('pageInfoChange',this.toParentData); 
      // this.$message(this.$refs.pg.pageSize);
    }
  },
};
</script>

<style scoped>
    .footer{
        margin-left: -20px;
        height: 33PX;
        width:100%;
        background-color: #ddd;
        position:fixed;
        bottom:0;
        right: 0;
        text-align: right;
        z-index: 999;
    }
</style>